using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;

namespace DNAide.Web.UI
{
	public static partial class PageAide
	{

		/// <summary>
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <param name="controlId"></param>
		/// <returns></returns>
		public static T FindControl<T>(string controlId) where T : Control
		{
			Page page = HttpContext.Current.CurrentHandler as Page;
			return FindControl<T>(page, controlId);
		}


		/// <summary>
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <param name="page"></param>
		/// <param name="controlId"></param>
		/// <returns></returns>
		public static T FindControl<T>(Page page, string controlId) where T : Control
		{
			if (page == null)
			{
				throw new ArgumentException("page null");
			}

			return ControlAide.FindControl<T>(page.Controls, controlId);
		}


	}
}
